' 
' Copyright (C) 2014 Infinity CCS Ltd (http://www.infinityccs.com/)
' Copyright (C) 2008 Sasa Coh <sasacoh@gmail.com>
'
' This program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 3 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program.  If not, see <http://www.gnu.org/licenses/>. 
'/


Imports System
imports System.Collections.Generic
imports System.Text

Namespace Common.CallLog
  ''' <summary>
  ''' Container providing call log functionality
  ''' </summary>
  Public MustInherit Class ICallLog

    ''' <summary>
    ''' Add call to call log
    ''' </summary>
    ''' <param name="type">call mode</param>
    ''' <param name="number">calling/called number</param>
    ''' <param name="name">calling/called name</param>
    ''' <param name="time">time of call</param>
    ''' <param name="duration">duration of call</param>
    MustOverride Sub addCall(type As ECallType, number As String, name As String, time As System.DateTime, duration As System.TimeSpan)

    ''' <summary>
    ''' Save call log records
    ''' </summary>
    MustOverride Sub save()

    ''' <summary>
    ''' get list of logged calls
    ''' </summary>
    ''' <returns>Call log list</returns>
    MustOverride Function getList() As Stack(Of CallRecord)

    ''' <summary>
    ''' get list of logged calls by call mode
    ''' </summary>
    ''' <param name="type">call mode</param>
    ''' <returns>Call log list</returns>
    MustOverride Function getList(type As ECallType) As Stack(Of CallRecord)

    ''' <summary>
    ''' Delete single record
    ''' </summary>
    ''' <param name="record">record to delete</param>
    MustOverride Sub deleteRecord(record As CallRecord)

#Region "Null Pattern"
    Public Class NullCallLogger
      Inherits ICallLog
      Public Overrides Sub addCall(type As ECallType, number As String, name As String, time As System.DateTime, duration As System.TimeSpan)

      End Sub

      Public Overrides Sub save()

      End Sub
      Public Overrides Function getList() As Stack(Of CallRecord)
        Return Nothing
      End Function
      Public Overrides Function getList(type As ECallType) As Stack(Of CallRecord)
        Return Nothing
      End Function
      Public Overrides Sub deleteRecord(record As CallRecord)

      End Sub
    End Class
#End Region
  End Class
End Namespace
